package com.echat.business.book.controller;

import com.echat.business.book.service.IBillBoardService;
import com.echat.business.book.service.IFollowListService;
import com.echat.business.book.service.IReadListService;
import com.echat.core.constant.response.ResponseData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author chentl
 * @version V1.0
 * @Project RankController
 * @Title RankController.java
 * @Description 排行榜--中央控制器
 * @Package com.echat.business.book.controller
 * @date 2019/6/6 13:25
 * @Copyright: 上海顺益信息科技有限公司 All rights reserved.
 */
@RestController
@Slf4j
@RequestMapping("/rank")
public class RankController {

    @Autowired
    private IFollowListService followListService;

    @Autowired
    private IReadListService readListService;

    @Autowired
    private IBillBoardService billBoardService;

    @RequestMapping(value = "/followList")
    public ResponseData getFollowList() {
        List<Map<String, Object>> follows = followListService.getFollowList();
        return new ResponseData(true, 200, "获取关注书籍排行列表成功", follows);
    }

    @RequestMapping(value = "/readList")
    public ResponseData getReadNumBookList() {
        List<Map<String, Object>> readList = readListService.getReadNumBookList();
        return new ResponseData(true, 200, "获取浏览量书籍排行列表成功", readList);
    }

    @RequestMapping(value = "/billBoardList")
    public ResponseData getBillBoardBookList() {
        List<Map<String, Object>> billBoards = billBoardService.getBillBoardBookList();
        return new ResponseData(true, 200, "获取大屏推送书籍列表成功", billBoards);
    }

}
